<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/3/22
  Time: 10:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>跳转页面</title>
    <script type="text/javascript" src="${pageContext.request.contextPath}/script/jquery-3.2.1.js"></script>
    <style type="text/css">
        h1, h2 {
            text-align: center;
        }

        h1 {
            margin-top: 199px;
        }

        body {
            background-image: url("../images/bg8.jpg");
            background-size: cover;
        }

        a {
            text-decoration: none;
        }
    </style>
    <script type="text/javascript">
        var num = ${jumpDetails.time};
        var timer;

        <%--function showTime() {--%>
            <%--if (num > 0) {--%>
                <%--$(".num").html(num);--%>
                <%--num -= 1;--%>
            <%--} else {--%>
                <%--$("h2").html("即将跳转...");--%>
                <%--window.clearInterval(timer);--%>
                <%--window.location.href = "${jumpDetails.nextUrl}";--%>
                <%--&lt;%&ndash;window.location.replace("${jumpDetails.nextUrl}");&ndash;%&gt;--%>
            <%--}--%>
        <%--}--%>

        <%--timer = window.setInterval(showTime, 1000);--%>

        function showTime1() {
//            var timer;
            if (num > 0) {
                $(".num").html(num);
                num -= 1;
                timer = setTimeout(showTime1, 1000);
            } else {
                $("h2").html("即将跳转...");
                clearTimeout(timer);
                window.location.href = "${jumpDetails.nextUrl}";
            }
        }

        $(function () {
            showTime1();
        })
    </script>
</head>
<body>
<h1>恭喜您，${jumpDetails.source} <a href="${jumpDetails.nextUrl}">${jumpDetails.nextPage}</a></h1>
<h2><span class="num">${jumpDetails.time}</span>秒后将自动跳转...</h2>
</body>
</html>
